﻿Namespace B1Objects
    Friend Class Form
        Implements B1Objects.IForm

        Public Shared Function NewForm(ByVal SapForm As SAPbouiCOM.Form) As B1Objects.IForm
            Return New Form(SapForm)
        End Function

        Private _SapForm As SAPbouiCOM.Form

        Private Sub New(ByVal SapForm As SAPbouiCOM.Form)
            _SapForm = SapForm
        End Sub

        Public Property ActiveItem As String Implements SAPbouiCOM.IForm.ActiveItem
            Get
                Return _SapForm.ActiveItem
            End Get
            Set(ByVal value As String)
                _SapForm.ActiveItem = value
            End Set
        End Property

        Public Property AutoManaged As Boolean Implements SAPbouiCOM.IForm.AutoManaged
            Get
                Return _SapForm.AutoManaged
            End Get
            Set(ByVal value As Boolean)
                _SapForm.AutoManaged = value
            End Set
        End Property

        Public ReadOnly Property BorderStyle As SAPbouiCOM.BoFormBorderStyle Implements SAPbouiCOM.IForm.BorderStyle
            Get
                Return _SapForm.BorderStyle
            End Get
        End Property

        Public ReadOnly Property BusinessObject As SAPbouiCOM.BusinessObject Implements SAPbouiCOM.IForm.BusinessObject
            Get
                Return _SapForm.BusinessObject
            End Get
        End Property

        Public ReadOnly Property ChooseFromLists As SAPbouiCOM.ChooseFromListCollection Implements SAPbouiCOM.IForm.ChooseFromLists
            Get
                Return _SapForm.ChooseFromLists
            End Get
        End Property

        Public Property ClientHeight As Integer Implements SAPbouiCOM.IForm.ClientHeight
            Get
                Return _SapForm.ClientHeight
            End Get
            Set(ByVal value As Integer)
                _SapForm.ClientHeight = value
            End Set
        End Property

        Public Property ClientWidth As Integer Implements SAPbouiCOM.IForm.ClientWidth
            Get
                Return _SapForm.ClientWidth
            End Get
            Set(ByVal value As Integer)
                _SapForm.ClientWidth = value
            End Set
        End Property

        Public Sub Close() Implements SAPbouiCOM.IForm.Close
            _SapForm.Close()
        End Sub

        Public ReadOnly Property DataBrowser As SAPbouiCOM.DataBrowser Implements SAPbouiCOM.IForm.DataBrowser
            Get
                Return _SapForm.DataBrowser
            End Get
        End Property

        Public ReadOnly Property DataSources As SAPbouiCOM.DataSource Implements SAPbouiCOM.IForm.DataSources
            Get
                Return _SapForm.DataSources
            End Get
        End Property

        Public Property DefButton As String Implements SAPbouiCOM.IForm.DefButton
            Get
                Return _SapForm.DefButton
            End Get
            Set(ByVal value As String)
                _SapForm.DefButton = value
            End Set
        End Property

        Public Sub EnableMenu(ByVal MenuUID As String, ByVal EnableFlag As Boolean) Implements SAPbouiCOM.IForm.EnableMenu
            _SapForm.EnableMenu(MenuUID, EnableFlag)
        End Sub

        Public Sub Freeze(ByVal newVal As Boolean) Implements SAPbouiCOM.IForm.Freeze
            _SapForm.Freeze(newVal)
        End Sub

        Public Function GetAsXML() As String Implements SAPbouiCOM.IForm.GetAsXML
            Return _SapForm.GetAsXML()
        End Function

        Public Property Height As Integer Implements SAPbouiCOM.IForm.Height
            Get
                Return _SapForm.Height
            End Get
            Set(ByVal value As Integer)
                _SapForm.Height = value
            End Set
        End Property

        Public ReadOnly Property IsSystem As Boolean Implements SAPbouiCOM.IForm.IsSystem
            Get
                Return _SapForm.IsSystem
            End Get
        End Property

        Public Property Left As Integer Implements SAPbouiCOM.IForm.Left
            Get
                Return _SapForm.Left
            End Get
            Set(ByVal value As Integer)
                _SapForm.Left = value
            End Set
        End Property

        Public ReadOnly Property Menu As SAPbouiCOM.Menus Implements SAPbouiCOM.IForm.Menu
            Get
                Return _SapForm.Menu
            End Get
        End Property

        Public ReadOnly Property Modal As Boolean Implements SAPbouiCOM.IForm.Modal
            Get
                Return _SapForm.Modal
            End Get
        End Property

        Public Property Mode As SAPbouiCOM.BoFormMode Implements SAPbouiCOM.IForm.Mode
            Get
                Return _SapForm.Mode
            End Get
            Set(ByVal value As SAPbouiCOM.BoFormMode)
                _SapForm.Mode = value
            End Set
        End Property

        Public Property PaneLevel As Integer Implements SAPbouiCOM.IForm.PaneLevel
            Get
                Return _SapForm.PaneLevel
            End Get
            Set(ByVal value As Integer)
                _SapForm.PaneLevel = value
            End Set
        End Property

        Public Sub Refresh() Implements SAPbouiCOM.IForm.Refresh
            _SapForm.Refresh()
        End Sub

        Public Sub ResetMenuStatus() Implements SAPbouiCOM.IForm.ResetMenuStatus
            _SapForm.ResetMenuStatus()
        End Sub

        Public Sub Resize(ByVal lWidth As Integer, ByVal lHeight As Integer) Implements SAPbouiCOM.IForm.Resize
            _SapForm.Resize(lWidth, lHeight)
        End Sub

        Public Sub [Select]() Implements SAPbouiCOM.IForm.Select
            _SapForm.Select()
        End Sub

        Public ReadOnly Property Selected As Boolean Implements SAPbouiCOM.IForm.Selected
            Get
                Return _SapForm.Selected()
            End Get
        End Property

        Public ReadOnly Property Settings As SAPbouiCOM.FormSettings Implements SAPbouiCOM.IForm.Settings
            Get
                Return _SapForm.Settings
            End Get
        End Property

        Public Property State As SAPbouiCOM.BoFormStateEnum Implements SAPbouiCOM.IForm.State
            Get
                Return _SapForm.State
            End Get
            Set(ByVal value As SAPbouiCOM.BoFormStateEnum)
                _SapForm.State = value
            End Set
        End Property

        Public Property SupportedModes As Integer Implements SAPbouiCOM.IForm.SupportedModes
            Get
                Return _SapForm.SupportedModes
            End Get
            Set(ByVal value As Integer)
                _SapForm.SupportedModes = value
            End Set
        End Property

        Public Property Title As String Implements SAPbouiCOM.IForm.Title
            Get
                Return _SapForm.Title
            End Get
            Set(ByVal value As String)
                _SapForm.Title = value
            End Set
        End Property

        Public Property Top As Integer Implements SAPbouiCOM.IForm.Top
            Get
                Return _SapForm.Top
            End Get
            Set(ByVal value As Integer)
                _SapForm.Top = value
            End Set
        End Property

        Public ReadOnly Property Type As Integer Implements SAPbouiCOM.IForm.Type
            Get
                Return _SapForm.Type
            End Get
        End Property

        Public ReadOnly Property TypeCount As Integer Implements SAPbouiCOM.IForm.TypeCount
            Get
                Return _SapForm.TypeCount
            End Get
        End Property

        Public ReadOnly Property TypeEx As String Implements SAPbouiCOM.IForm.TypeEx
            Get
                Return _SapForm.TypeEx
            End Get
        End Property

#If UI_Ver88 Then
        Public ReadOnly Property UDFFormUID As String Implements SAPbouiCOM.IForm.UDFFormUID
            Get
                Return _SapForm.UDFFormUID
            End Get
        End Property


        Public Property ReportType As String Implements SAPbouiCOM.IForm.ReportType
            Get
                Return _SapForm.ReportType '8.81新增
            End Get
            Set(ByVal value As String)
                _SapForm.ReportType = value
            End Set
        End Property
#End If

        Public ReadOnly Property UniqueID As String Implements SAPbouiCOM.IForm.UniqueID
            Get
                Return _SapForm.UniqueID
            End Get
        End Property

        Public Sub Update() Implements SAPbouiCOM.IForm.Update
            _SapForm.Update()
        End Sub

        Public Property Visible As Boolean Implements SAPbouiCOM.IForm.Visible
            Get
                Return _SapForm.Visible
            End Get
            Set(ByVal value As Boolean)
                _SapForm.Visible = value
            End Set
        End Property

        Public Property Width As Integer Implements SAPbouiCOM.IForm.Width
            Get
                Return _SapForm.Width
            End Get
            Set(ByVal value As Integer)
                _SapForm.Width = value
            End Set
        End Property

        Public ReadOnly Property Items As SAPbouiCOM.Items Implements SAPbouiCOM.IForm.Items
            Get
                Return _SapForm.Items
            End Get
        End Property

        Public ReadOnly Property ItemsEx As B1Objects.IItems Implements B1Objects.IForm.ItemsEx
            Get
                Dim oItems As New B1Objects.Items(_SapForm.Items)
                Return oItems
            End Get
        End Property

    End Class
End Namespace

